﻿@model IEnumerable<MVCWebUIComponent.Models.AppModel>    
@{
    ViewBag.Title = "Index";
}
<script type="text/javascript" src="../../Scripts/Uploadify/jquery.uploadify.min.js"></script>
<link href="../../Scripts/Uploadify/uploadify.css" rel="stylesheet" type="text/css" />
<script src="@Url.Content("~/Scripts/Uploadify/jquery.js")" type="text/javascript"></script>
<style type="text/css">
    .uploadbutton
    {
        background: Gray;
        font-weight: normal;
        font-size: 0.9em;
    }
</style>
<script type="text/javascript">
    $(function () {
        $('#file_upload').uploadify({
            'formData': {
                'timestamp': '',
                'token': ''
            },
            'buttonClass': 'uploadbutton',
            'buttonText': 'Upload...',
            'height': 20,
            'width': 120,
            'fileTypeDesc': 'Xml File',
            'fileTypeExts': '*.xml',
            'swf': '../Content/Uploadify/uploadify.swf',
            'uploader': '@Url.Action("UploadXml")',
            'onUploadSuccess': function (file, data, response) {
                //alert('The file ' + file.name + ' was successfully uploaded with a response of ' + response + ':' + data);
                var obj = eval("(" + data + ")");
                if (obj["HasError"] == "1") alert(obj["ErrMsg"]);
                location.reload();
            }
        });
    });
</script>
@*<h2>Index</h2>*@
<div style="height: 90px; margin-top: -15px;">
    <img alt="Entities" style="width: 65px; height: 90px; float: left" src="../../Content/images/App.png" />
    <div style="width: 300px; float: left; margin-top: 30px; margin-left: 10px; font-size: 36px;
        color: black;">
        Apps</div>
</div>
<div>
    <ul id="userAppList" style="font-size: x-large">
        @*<li>@Html.ActionLink("Seat Reservation Application", "Index", "Seat")</li>*@
        @foreach (var app in Model)
        {
            <li>@Html.ActionLink(app.AppName, "Nova", new { pageIndex = 1, userAppName = app.AppFileNameWithExtension })</li>
        }
    </ul>
</div>
<h1>
    Upload New Application XML</h1>
<br />
<input id="file_upload" name="file_upload" type="file" multiple="true" style="margin: 10px" />
